package com.example.demo.dao.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.sql.Timestamp;
import java.time.LocalDateTime;

/**
 * <p>
 * Users and global privileges
 * </p>
 *
 * @author ayatsuji
 * @since 2022-03-03
 */
// 如果表和实体名字不同就可以加这个注解
@TableName("app_user")
public class User {
    @TableId(value = "id", type = IdType.AUTO)  // 表示主键是这个id字段，并且是自增的
    private Long id;

    // 字段名称和成员变量名称不同就用这个注解
    @TableField("name")
    private String username;
    private Integer age;
    private String email;
    // 字段名称和成员变量名称自动按驼峰转换
    private Timestamp createTime;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", age=" + age +
                ", email='" + email + '\'' +
                ", createTime=" + createTime +
                '}';
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }
}
